package kr.hkit.powerjava.chapter06;

public class GuguDan {
	public static void main(String[] args) {
		/*System.out.printf("%2d *%2d = %2d %n", 2, 1, 2 * 1);
		System.out.printf("%2d *%2d = %2d %n", 2, 2, 2 * 2);
		System.out.printf("%2d *%2d = %2d %n", 2, 3, 2 * 3);
		System.out.printf("%2d *%2d = %2d %n", 2, 4, 2 * 4);
		System.out.printf("%2d *%2d = %2d %n", 2, 5, 2 * 5);
		System.out.printf("%2d *%2d = %2d %n", 2, 6, 2 * 6);
		System.out.printf("%2d *%2d = %2d %n", 2, 7, 2 * 7);
		System.out.printf("%2d *%2d = %2d %n", 2, 8, 2 * 8);
		System.out.printf("%2d *%2d = %2d %n", 2, 9, 2 * 9);*/

		calGuguDan();
		
//		calGuguDan(5);
//		calReverseGuguDan();
	}

	private static void calGuguDan(int dan) {
		int i =1;
		System.out.println("====="+dan+" 단=====");
		while (i < 10) {
			System.out.printf("%2d *%2d = %2d %n", dan, i, dan * i);
			i++;
		}

	}

	private static void calReverseGuguDan() {
		int i = 9;

		while (i > 0) {
			System.out.printf("%2d *%2d = %2d %n", 2, i, 2 * i);
			i--;
		}

	}

	private static void calGuguDan() {
		int dan = 2;
		while(dan <10)
			{
				int i = 1;
				while (i < 10) {
					System.out.printf("%2d *%2d = %2d %n", dan, i, dan * i);
					i++;		
				}
			dan++;
		}

	}

}
